import axios from 'axios'
import {Message, MessageBox} from 'element-ui'
import store from '@/store'
import {getToken} from '@/utils/auth'

axios.defaults.withCredentials = true

const service = axios.create({
    baseURL: "http://localhost:8082",
    timout: 5000
})

service.interceptors.request.use(
    config => {
        if(store.getters.token) {
            config.headers['X-Admin-Token'] = getToken()
        }
        return config
    },
    error => {
        console.log(error)
        Promise.reject(error)
    }
)

service.interceptors.response.use(
    response => {
        const res = response.data

        
    }
)